<template>
	<om-formsub-outer :index="index" :checkedit="checkedit" :deleteBtn="false">
		<om-autoform ref="autoform" :initConfigData="autoformdata" :initValue="initValue"></om-autoform>
	</om-formsub-outer>
</template>

<script>
	import {buildSubFormData, subOnLoad, changeEditor,configSelectData,hasValue} from '@/static/js/formUtil.js';
	import { ignoreHtml,ptFloat,minusF,getDateStr} from '@/static/js/common.js';
	import { mapState } from 'pinia';
	import {useLoginUserStore} from '@/stores/login-user.js';
	export default {
		computed: {
			...mapState(useLoginUserStore, ['userName', 'userId'])
		},
		provide() {
			return {
				formPage: this
			};
		},
		data() {
			return buildSubFormData()
		},
		methods:{
			onSelectInterviewFlag(data){
				let _that = this
				_that.$refs.autoform.formdata.interviewFlagName = data.name
			}
		},
		onShow() {
			
		},
		onLoad(e) {
			let _that = this
			subOnLoad(_that, e, function() {
			if(e.configDataCacheKey){
				uni.getStorage({
					key: e.configDataCacheKey,
					success: function(res) {
						if(res.data && Object.prototype.toString.call(res.data)==='[object Array]'){
							_that.autoformdata = res.data
							Object.assign(_that.initValue, _that.formdata)
							_that.autoformdata[0].order = _that.order
							
							_that.om.request('/dictZero/findBooleanDtoList').then(res => {
								if(res.length>0){
									_that.$nextTick(function(){
										if(_that.userId == _that.formdata.instDirectorId){
											_that.$refs.autoform.changeEditor("instDirectorInfo", "interviewFlag", "data", configSelectData(res,"value","name"))
											_that.$refs.autoform.initSelectIndex("instDirectorInfo", "interviewFlag")
										}else{
											_that.$refs.autoform.changeEditor("instDirectorInfo","interviewFlag","type","labelbox")
											_that.$refs.autoform.changeEditor("instDirectorInfo","opinion","type","labelbox")
										}	
									})		
								}else{
									_that.om.toast(res.msg);
								}
							})
							
													
							}
						}
					})
				}
							
			})
		}
	}
</script>

<style>
</style>                                                                                                                                                                                                                                                                                                                                                                                                                                                         
